Let's first check the Python version you have installed on your machine. Remember, to run the examples, it must be 2.7.X
In [1]:
import sys
print "Your Python version is", sys.version
Now let's check if you have all the necessary toolkits installed and working properly:
In [2]:
errors = 0
In [3]:
try:
import numpy as np
print "Numpy installed, version", np.__version__
except ImportError:
print "Numpy is not installed!"
errors += 1
In [4]:
try:
import scipy
print "Scipy installed, version", scipy.__version__
except ImportError:
print "Scipy is not installed!"
errors += 1
In [5]:
try:
import matplotlib
print "Matplotlib installed, version", matplotlib.__version__
except ImportError:
print "Matplotlib is not installed!"
errors += 1
In [6]:
try:
import sklearn
print "Sklearn installed, version", sklearn.__version__
except ImportError:
print "Sklearn is not installed!"
errors += 1
In [7]:
try:
import networkx
print "Networkx installed, version", networkx.__version__
except ImportError:
print "Networkx is not installed!"
errors += 1
In [8]:
try:
import nltk
print "Nltk installed, version", nltk.__version__
except ImportError:
print "Nltk is not installed!"
errors += 1
Here''s the verdict:
In [9]:
if errors == 0:
print "Your machine can run the code"
else:
print "We found", errors, "errors. Please check them and install the missing toolkits"